from flask import Flask

from db import db


def create_app():
    app = Flask(__name__)
    app.config['SQLALCHEMY_DATABASE_URI'] = "mysql+pymysql://root:example.com@127.0.0.1:3306/ai_line_rebirth"
    db.init_app(app)

    # 注册蓝图
    from .ai_api import ai_api
    from .image_identify import image_identify
    from .user_image_api import user_image_api

    app.register_blueprint(ai_api)
    app.register_blueprint(image_identify)
    app.register_blueprint(user_image_api)

    return app
